// 引入vue模块
import vue from 'vue';
import vueRouter from 'vue-router';
// 给vue模块增加路由功能
vue.use(vueRouter);

// 引入路由
import index from "../components/index.vue";
import home from "../components/home.vue";
import search from "../components/search.vue";
import hotSongRank from "../components/hotSongRank.vue";
import playlist from "../components/playlist.vue";
import player from "../components/player.vue";

// 路由配置
const route = [
    {path:"",redirect:"/home",name:"home"},
    {path:"/index",component:index, name:"index",
        children:[
            {path:"/",redirect:"home"},
            {path:"/home",component:home},
            {path:"/search",component:search},
            {path:"/hotSongRank",component:hotSongRank},
        ]
    },
    {path:"/playlist",component:playlist, name:"playlist"},
    {path:"/player",component:player, name:"player"},
];

// 创建router实例
const router = new vueRouter({
    routes : route
});

// 输出router实例
export default router;